package com.youpingou.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.youpingou.domain.Sku;
import com.youpingou.domain.Spu;
import org.apache.ibatis.annotations.*;

@Mapper
public interface SpuMapper extends BaseMapper<Spu> {

    @Select("select * from tb_spu where id = #{spuId}")
    @Results({
            @Result(property = "brand",column = "brand_id",
                    one = @One(select = "com.youpingou.mapper.BrandMapper.selectById")),
            @Result(property = "cat3",column = "cat3_id",
                    one = @One(select = "com.youpingou.mapper.CategoryMapper.selectById")),
    })
    public Spu findSpuBySpuId(Integer spuId);

}
